package com.taobao.api.request;

import com.taobao.api.internal.util.RequestCheckUtils;
import java.util.Map;

import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.TmallEaiOrderRegisterResponse;
import com.taobao.api.ApiRuleException;
/**
 * TOP API: tmall.eai.order.register request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class TmallEaiOrderRegisterRequest implements TaobaoRequest<TmallEaiOrderRegisterResponse> {

	private Map<String, String> headerMap = new TaobaoHashMap();
	private TaobaoHashMap udfParams; // add user-defined text parameters
	private Long timestamp;

	/** 
	* 对传入的事件的操作类型 0:取消订阅;1:订阅
	 */
	private Long action;

	/** 
	* 1:主订单模式;
2:子订单模式;
天猫退款消息订阅默认子订单模式。
不传入即可。
	 */
	private Long dataMode;

	/** 
	* 需要订阅或者取消订阅的事件名称。
可选择的值如下所示:
RcRefundClosedEvent;
RcRefundPrepaidEvent;
RcReturnCreatedEvent;
RcRefundSucceedEvent;
RcRefundCreatedEvent;
RcRefundModifiedEvent;
RcReturnModifiedEvent;
RcRefundSellerRefuseEvent;
RcReturnConfirmFailedEvent;
RcRefundTaobaoInvolvedEvent;
RcRefundMessageCreatedEvent;
RcReturnConfirmSucceedEvent;
RcRefundPaymentFinishedEvent;
RcRefundRefundableMarkedEvent;
RcReturnBuyerReturnGoodsEvent;
RcRefundSellerAgreeReturnEvent;
RcRefundRefundableCanceledEvent;
	 */
	private String eventName;

	/** 
	* 天猫退款订单可选topic:
tmall.eai.order.refund.refundBill.push;
tmall.eai.order.refund.refundStatus.push
	 */
	private String topic;

	/** 
	* 标识出用户类型。
这里“用户”指的是外部开发者。
0:TOP-OPEN-API 用户
1:JIP用户
	 */
	private Long userType;

	public void setAction(Long action) {
		this.action = action;
	}
	public Long getAction() {
		return this.action;
	}

	public void setDataMode(Long dataMode) {
		this.dataMode = dataMode;
	}
	public Long getDataMode() {
		return this.dataMode;
	}

	public void setEventName(String eventName) {
		this.eventName = eventName;
	}
	public String getEventName() {
		return this.eventName;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}
	public String getTopic() {
		return this.topic;
	}

	public void setUserType(Long userType) {
		this.userType = userType;
	}
	public Long getUserType() {
		return this.userType;
	}

	public Long getTimestamp() {
		return this.timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}

	public String getApiMethodName() {
		return "tmall.eai.order.register";
	}

	public Map<String, String> getTextParams() {		
		TaobaoHashMap txtParams = new TaobaoHashMap();
		txtParams.put("action", this.action);
		txtParams.put("data_mode", this.dataMode);
		txtParams.put("event_name", this.eventName);
		txtParams.put("topic", this.topic);
		txtParams.put("user_type", this.userType);
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	public void putOtherTextParam(String key, String value) {
		if(this.udfParams == null) {
			this.udfParams = new TaobaoHashMap();
		}
		this.udfParams.put(key, value);
	}

	public Class<TmallEaiOrderRegisterResponse> getResponseClass() {
		return TmallEaiOrderRegisterResponse.class;
	}

	public void check() throws ApiRuleException {
		RequestCheckUtils.checkNotEmpty(action,"action");
		RequestCheckUtils.checkNotEmpty(eventName,"eventName");
		RequestCheckUtils.checkMaxLength(eventName,50,"eventName");
		RequestCheckUtils.checkNotEmpty(topic,"topic");
	}

	public Map<String, String> getHeaderMap() {
		return headerMap;
	}
}
